/**
 * output package name
 */
package com.kingdee.eas.minghua.finance.client;

import java.awt.event.*;
import java.util.Calendar;
import java.util.Date;

import org.apache.log4j.Logger;

import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.metadata.entity.FilterItemInfo;
import com.kingdee.bos.metadata.query.util.CompareType;
import com.kingdee.bos.ui.face.CoreUIObject;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.eas.basedata.master.auxacct.GeneralAsstActTypeInfo;
import com.kingdee.eas.basedata.person.PersonInfo;
import com.kingdee.eas.framework.*;

/**
 * output class name
 */
public class FinanceBillFilterUI extends AbstractFinanceBillFilterUI
{
    private static final Logger logger = CoreUIObject.getLogger(FinanceBillFilterUI.class);
    
    /**
     * output class constructor
     */
    public FinanceBillFilterUI() throws Exception
    {
        super();
    }
    public void onLoad() throws Exception {
    	// TODO Auto-generated method stub
    	super.onLoad();
    	kDDatePicker1.setValue(null);
    	kDDatePicker2.setValue(null);
    	
    }
    public FilterInfo getFilterInfo() {
		FilterInfo filter = new FilterInfo();
		if(kDBizPromptBox1.getValue()!=null){
             GeneralAsstActTypeInfo gInfo = (GeneralAsstActTypeInfo)kDBizPromptBox1.getValue();
         	if(gInfo!=null&&gInfo.getId()!=null)
				filter.getFilterItems().add(new FilterItemInfo("gcxm.id", "%"+gInfo.getId() + "%",CompareType.LIKE));
		}
		if (kDDatePicker1.getValue()!= null){		
			Calendar calendar1 = Calendar.getInstance();
			calendar1.setTime((Date)kDDatePicker1.getValue());
			calendar1.add(Calendar.DATE, -1);
			calendar1.set(calendar1.get(Calendar.YEAR), calendar1.get(Calendar.MONTH), calendar1.get(Calendar.DATE),23, 59, 59);
			filter.getFilterItems().add(new FilterItemInfo("bizDate",calendar1.getTime(),CompareType.GREATER_EQUALS));
         }
		if (kDDatePicker2.getValue()!= null){
			Calendar calendar2 = Calendar.getInstance();
			calendar2.setTime((Date)kDDatePicker2.getValue());
//			calendar2.add(Calendar.DATE, 1);
			calendar2.set(calendar2.get(Calendar.YEAR), calendar2.get(Calendar.MONTH), calendar2.get(Calendar.DATE),23, 59, 59);
			filter.getFilterItems().add(new FilterItemInfo("bizDate",calendar2.getTime(),CompareType.LESS_EQUALS));
		}
		return filter;
    }
    /**
     * output storeFields method
     */
    public void storeFields()
    {
        super.storeFields();
    }

}